package Add_N;

import AnnualIncome.AnnualIncomeMapper;
import AnnualIncome.AnnualIncomeReducer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class AddDriver {
    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

        args = new String[]{"D:\\niit\\input\\demo", "D:\\niit\\output\\AddDriver"};


        Configuration conf = new Configuration();
        conf.set("hbase.zookeeper.quorum","node-1,node-2,node-3");
        Job job = Job.getInstance(conf);


        job.setJarByClass(AddDriver.class);


        job.setMapperClass(AddMapper.class);
        job.setReducerClass(AddReducer.class);


        job.setMapOutputKeyClass(IntWritable.class);
        job.setMapOutputValueClass(NullWritable.class);


        job.setOutputKeyClass(IntWritable.class);
        job.setOutputValueClass(NullWritable.class);


        FileInputFormat.addInputPath(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));


        boolean result = job.waitForCompletion(true);
        System.exit(result ? 0 : 1);
    }
}
